
  let ajaxTimes = 0;
export const request = (params) => {
   ajaxTimes++;
  wx.showLoading({
    title: '加载中',
  });
  
   return new Promise((resolve,reject) => {
     const beasURL = "https://api.zbztb.cn/api/public/v1"
    wx.request({
       ...params,
       url: beasURL+params.url,
       success: (result) => {
        resolve(result.data.message);
       },
       fail: (err) => {
        reject(err)
       },
       complete: () =>{
        //  关闭加载中
        ajaxTimes--;
        if(ajaxTimes===0){
        // 关闭最后一个请求后消失
          wx.hideLoading();
        }
       }
     });
       
   });
}